package com.pk.platform.business.common.web;

import java.util.ArrayList;
import java.util.List;

import com.pk.platform.business.common.service.IClaService;
import com.pk.platform.business.common.vo.ChildVO;
import com.pk.platform.business.common.vo.ClaVO;
import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.business.data.service.IBaseDataService;
import com.pk.platform.domain.common.Cla;
import com.pk.platform.domain.common.Kindergarten;
import com.pk.platform.domain.data.BaseData;
import com.pk.platform.domain.privilege.User;
import com.pk.platform.util.constant.ChargeConstant;
import com.pk.platform.util.constant.PrivilegeConstant;

public class ClaAction extends GenericAction {

	private IClaService claService;
	
	private ClaVO clavo = new ClaVO();
	
	private Cla cla = new Cla();
	
	private ChildVO childvo = new ChildVO();
	
	private boolean flag = false;
	
	private IBaseDataService baseDataService;
	
	private List<BaseData> classTypeList = new ArrayList<BaseData>();
	
	public String classManage()
	{
		clavo.setKindergartenId(kindergartenId);
		lp = claService.queryCla(clavo, pager);
		//查看或修改
		operateChn = PrivilegeConstant.getOperate(PrivilegeConstant.UPDATE_CLASS);
		return SUCCESS;
	}
	
	public String toAddClass()
	{
		classTypeList = baseDataService.queryBaseDataByParentId(ChargeConstant.CLASS_TYPE);
		return SUCCESS;
	}
	
	public String addClass()
	{
		Kindergarten k = new Kindergarten(kindergartenId);
		cla.setKindergarten(k);
		claService.addClass(cla);
		return SUCCESS;
	}
	
	public String toUpdateClass()
	{
		classTypeList = baseDataService.queryBaseDataByParentId(ChargeConstant.CLASS_TYPE);
		cla = claService.queryClassById(cla.getId());
		return SUCCESS;
	}
	
	public String updateClass()
	{
		claService.updateClass(cla);
		return SUCCESS;
	}
	
	public String delClass()
	{
		flag = claService.delClass(cla.getId());
		return SUCCESS;
	}
	
	

	public IClaService getClaService() {
		return claService;
	}

	public void setClaService(IClaService claService) {
		this.claService = claService;
	}

	public ClaVO getClavo() {
		return clavo;
	}

	public void setClavo(ClaVO clavo) {
		this.clavo = clavo;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public Cla getCla() {
		return cla;
	}

	public void setCla(Cla cla) {
		this.cla = cla;
	}

	public ChildVO getChildvo() {
		return childvo;
	}

	public void setChildvo(ChildVO childvo) {
		this.childvo = childvo;
	}

	public IBaseDataService getBaseDataService() {
		return baseDataService;
	}

	public void setBaseDataService(IBaseDataService baseDataService) {
		this.baseDataService = baseDataService;
	}

	public List<BaseData> getClassTypeList() {
		return classTypeList;
	}

	public void setClassTypeList(List<BaseData> classTypeList) {
		this.classTypeList = classTypeList;
	}
	
}
